<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
require_once("../Scripts/DatabaseConnect.php");
require_once("../Scripts/UpdateStocks.php");//Checks if we need to update the database with new market data.

//Check if we need local server or remote server
$con=Remoteconnect();
if($con==null){
	$con=Localconnect();	
}
//Display the last update date and current date and time.
$lastUpdate="";
$result = mysqli_query($con,"SELECT * FROM  `time`");

while($row = mysqli_fetch_array($result)) {
	$lastUpdate=$row['LastUpdate'];

  
}

$date = date('m-d-Y h:i:s a', time());//gets current date and time of server.
echo"Date: $date, Last Update: $lastUpdate";
session_start(); 
?>
<script type="text/javascript">
	window.onload=function stopLong(){
		if(document.getElementById("StopLong").value=="StopIndicator"){
			document.getElementById("StopIndicator").style.display="block";
		}else{
			document.getElementById("StopIndicator").style.display="none";
		}
		
		if(document.getElementById("LongTarget").value=="LongIndicator"){
			document.getElementById("LongIndicator").style.display="block";
		}else{
			document.getElementById("LongIndicator").style.display="none";
		}
		
	}
	</script>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<title>J&J Free Stock backtesting</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="businesstoday/styles/layout.css" type="text/css" />
</head>
<body id="top">
<div class="wrapper col1">
  <div id="header">
    <img src="../Images/the-top-5-high-volume-trading-stocks-of-the-week_1118_437849_0_14042581_500.jpg" alt="" width="240" height="162" />
    <div id="logo">
      <h1>J&amp;J Free Stock Backtesting    </h1>
    </div>
  <div id="newsletter">
    <div id="login" style="display:block; min-height:50px; min-width:600px;">
      <p><a href="#">Lost your password?</a> <a href="register.php">Register</a>

      </p>
      
      <form action="../Scripts/authenticate.php" method="post" >
      
        <fieldset>
          <legend>NewsLetter</legend>
          <table>
            <tr>
              <td>Name:</td>
              <td><input type="email" name="email" required="required" id="email" /></td>
              <td>Password:</td>
              <td><input type="password" name="password" required="required" id="password" /></td>
              <td><input type="submit" name="news_go" id="news_go" value="Login" /></td>
            </tr>
          </table>
        </fieldset>
      </form>


      </div>
      
      <?php
	  //Wrong password message
      if (isset($_SESSION['msg'])) {
	echo "<p style='color:red'>".$_SESSION['msg']."</p>"; 
	//remove the message since it has been displayed.
	unset($_SESSION['msg']);
	}
	?>
    
   	<?php
	//logout button
    if (isset($_SESSION['msgG'])) {
		echo"<form>";
		echo "<p style='color:green'>".$_SESSION['msgG']."</p>"; 
		echo '<input type="button" name="logout" id="logout" value="Logout" onClick="location.href=\'../Scripts/Logout.php\'"/>'; 
		echo"</form>";
	}
	
?> 
  

    </div>
    <br class="clear" />
  </div>
</div>

<div class="wrapper col2">
  <div id="topbar">
    <div id="topnav">
      <ul>
        <li class="active">
         
              <li><a href="index.php">Home Page</a></li>
              <li id="portfolio" style="display:none"><a href="portfolio.php">Stock Portfolio</a></li>
              <li id="stockMonitoring" style="display:none"><a href="stockMonitoring.php">Stock Monitoring</a></li>
              <li><a href="stockbacktest.php">Stock Backtest</a></li>
              <li><a href="charts.php">Stock Charts</a>
               <ul>
            <li><a href="chartDifShares.php">Stock Prices Comparision Chart</a></li>
            <li><a href="chartIndicators.php">Stock Technical Analysis Chart</a></li>
         
          </ul>
        </li>

        
  </li>      
        
        
      </ul>
    </div>
 <script type="text/javascript">
 //Hides/Shows navigation bar links based on logged in status
	  var check = <?php echo json_encode(isset($_SESSION['email'])); ?>;
	  
	  if(check==true){
		  document.getElementById("login").style.display="none";
		  document.getElementById("portfolio").style.display="block";
		  document.getElementById("stockMonitoring").style.display="block";

	  }else{
		  document.getElementById("login").style.display="block";
		  document.getElementById("stockMonitoring").style.display="none";
		  document.getElementById("portfolio").style.display="none";
		  
	  }
	 
 </script>
 
       
    <br class="clear" />
  </div>
</div>
<div class="wrapper col3">
  <div id="intro">
    <div class="fl_right"></div>

    <br class="clear" />
  </div>
</div>
<div class="wrapper col4"></div>
<div class="wrapper col5">
  <div id="container">
    <div id="content">
      <h2>Stock Back Testing</h2>
       <form id="Add to backTestProcess" name="backTestProcess" method="post" action="backTestProcess.php">
            <p>
              <label for="textfield2">Add Symbol:</label>
              <?php
			  	
    

			  	$con=Remoteconnect();
				if($con==null){					
					$con=Localconnect();						
				}
				$result = mysqli_query($con,"SELECT * FROM  `company info`");


				echo "<select id='Symbol' name='Symbol'>";

				while($row = mysqli_fetch_array($result)) {
					
    				echo "<option value='$row[Symbol]'>" . $row['Symbol'] . "</option>";

				}
				
				echo "</select>";
				mysqli_close($con);
				
			  
			  ?>
            </p>
            <p>Starting Capital: $
              <input type="numbers" name="StartingCapital" id="StartingCapital">
            </p>
            <p>Trading Commission:
              $
                <input type="numbers" name="TradingCommission" id="TradingCommission">
            </p>
            <p>
              <select id="StopLong" name="StopLong" onchange="stopLong()">
                <option value="Stop%">Stop Target</option>
                <option value="StopIndicator" >Stop Indicator Target</option>
              </select>
              : 
              <input type="numbers" name="StopLongInput" value = "10" id="StopLongInput">
%            
			<div id="StopIndicator" style="display:none">
            <table width="200" border="1">
              <tr>
             <td>Sell when: </td>
                <td><select id="StopIndicatorSell1_1" name="StopIndicatorSell1_1" onchange="AutoInput('StopIndicatorSell1_1','StopIndicatorSellInput1_1')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                 <option value="SAR">SAR(acceleration/maximum)</option>
                 <option value="WMA">WMA</option>
                 <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                 <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                 <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="ROC">ROC(days)</option>
                 <option value="OBV">OBV</option>
                 <option value="PVT">PVT</option>
                 <option value="WilliamR">WilliamR(days)</option>
                 <option value="MTM">MTM(days)</option>
                 <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
                <td>IS:</td>
                <td><select id="StopIndicatorSell1_2" name="StopIndicatorSell1_2" onchange="AutoInput('StopIndicatorSell1_2','StopIndicatorSellInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="StopIndicatorSell1_3" name="StopIndicatorSell1_3" onchange="AutoInput('StopIndicatorSell1_3','StopIndicatorSellInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>       
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="StopIndicatorSellInput1_1" id="StopIndicatorSellInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="StopIndicatorSellInput1_2" id="StopIndicatorSellInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="StopIndicatorSellInput1_3" id="StopIndicatorSellInput1_3"></td>
              </tr>
            </table>
            
            </div>
              <select id="LongTarget" name="LongTarget" onchange="LongIndicator()">
                <option value="UseReturnTarget%" selected="selected">Use Return Target</option>
                <option value="LongIndicator">Long Indicator Target</option>
              </select>
              
:  
              <input type="numbers" name="LongTargetInput" value="10" id="LongTargetInput">
            %</p>
            
            <div id="LongIndicator" style="display:none">
            <table width="200" border="1">
              <tr>
            <td>Sell when: </td>
                <td><select id="LongIndicatorSell1_1" name="LongIndicatorSell1_1" onchange="AutoInput('LongIndicatorSell1_1','LongIndicatorSellInput1_1')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                 <option value="SAR">SAR(acceleration/maximum)</option>
                 <option value="WMA">WMA</option>
                 <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                 <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                 <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="ROC">ROC(days)</option>
                 <option value="OBV">OBV</option>
                 <option value="PVT">PVT</option>
                 <option value="WilliamR">WilliamR(days)</option>
                 <option value="MTM">MTM(days)</option>
                 <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
                <td>IS:</td>
                <td><select id="LongIndicatorSell1_2" name="LongIndicatorSell1_2" onchange="AutoInput('LongIndicatorSell1_2','LongIndicatorSellInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="LongIndicatorSell1_3" name="LongIndicatorSell1_3" onchange="AutoInput('LongIndicatorSell1_3','LongIndicatorSellInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>       
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="LongIndicatorSellInput1_1" id="LongIndicatorSellInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="LongIndicatorSellInput1_2" id="LongIndicatorSellInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="LongIndicatorSellInput1_3" id="LongIndicatorSellInput1_3"></td>
              </tr>
            </table>
            
            
            </div>
            
              
            <p>
  
              <label for="textfield">Start Date: </label>
              <input type="date" name="StartDate" id="StartDate"> 
              <label for="textfield5">End Date: </label>
              <input type="date" name="EndDate" id="EndDate">
            </p>
            <p>
              <label for="textfield">Lock Size: </label>
              <input type="number" name="LockSize" id="LockSize"> 
            </p>
            <p>&nbsp;</p>
            <table width="200" border="1">
              <tr>
                <td>Buy when:</td>
                <td><select id="Buy1_1" name="Buy1_1" onchange="AutoInput('Buy1_1','BuyInput1_1')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		 
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                  
                </select></td>

                <td>IS:</td>
                <td><select id="Buy1_2" name="Buy1_2" onchange="AutoInput('Buy1_2','BuyInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="Buy1_3" name="Buy1_3" onchange="AutoInput('Buy1_3','BuyInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_1" id="BuyInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_2" id="BuyInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="BuyInput1_3" id="BuyInput1_3"></td>
              </tr>
              <tr>
                <td>Sell when: </td>
                <td><select id="Sell1_1" name="Sell1_1" onchange="AutoInput('Sell1_1', 'SellInput1_1')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                 <option value="SAR">SAR(acceleration/maximum)</option>
                 <option value="WMA">WMA</option>
                 <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                 <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                 <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                 <option value="ROC">ROC(days)</option>
                 <option value="OBV">OBV</option>
                 <option value="PVT">PVT</option>
                 <option value="WilliamR">WilliamR(days)</option>
                 <option value="MTM">MTM(days)</option>
                 <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
                <td>IS:</td>
                <td><select id="Sell1_2" name="Sell1_2" onchange="AutoInput('Sell1_2', 'SellInput1_2')">
                  <option value="" selected></option>
                  <option value="Above">Above</option>
                  <option value="Below">Below</option>
                  <option value="AtLeast%Above%">At least % above (%)</option>
                  <option value="AtLeast%Below%">At Least % below (%)</option>
                </select></td>
                <td>Then the:</td>
                <td><select id="Sell1_3" name="Sell1_3" onchange="AutoInput('Sell1_3', 'SellInput1_3')">
                  <option value="" selected></option>
                  <option value="SMA">Simple Moving Average (days)</option>
                  <option value="EMA">Exponential Moving Average (days)</option>
                  <option value="ClosingPrice">Closing Price</option>
                  <option value="OpeningPrice">Opening Price</option>
                  <option value="Highest">Highest</option>
                  <option value="Lowest">Lowest</option>
                  <option value="Volume">Volume</option>
                  <option value="Value">Value</option>
                  <option value="RSI">RSI</option>
                  <option value="SAR">SAR(acceleration/maximum)</option>
                  <option value="WMA">WMA</option>       
                  <option value="BollingerUpper">Bollinger band upper (days/Deviation)</option>           		  
                  <option value="BollingerLower">Bollinger band lower (days/Deviation)</option>
                  <option value="MacD">MacD (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="MacDSignal">MacD Signal line (shorter EMA/longer EMA/signal EMA of MacD</option>
                  <option value="ROC">ROC(days)</option>
                  <option value="OBV">OBV</option>
                  <option value="PVT">PVT</option>
                  <option value="WilliamR">WilliamR(days)</option>
                  <option value="MTM">MTM(days)</option>
                  <option value="fastSTCk">fastSTC %K (%K,%D)</option>
                  <option value="fastSTCd">fastSTC %D (%K,%D)</option>
                  <option value="DMIplus">plus DMI(days)</option>
                  <option value="DMIminus">minus DMI(days)</option>
                </select></td>
              </tr>
              <tr>
                <td>Input</td>
                <td><input type="text" name="SellInput1_1" id="SellInput1_1"></td>
                <td>Input</td>
                <td><input type="text" name="SellInput1_2" id="SellInput1_2"></td>
                <td>Input</td>
                <td><input type="text" name="SellInput1_3" id="SellInput1_3"></td>
              </tr>
            </table>
            <p>
            </p>
           
            <p>&nbsp;</p>
            <p>
              <input type="submit" name="Backtest" value="Backtest" />
            </p>
            
          <p>&nbsp;</p>
          </form>
      
    </div>
    <br class="clear" />
  </div>
</div>
<div class="wrapper col6"></div>
<div class="wrapper col7">
  <div id="copyright">
    <p class="fl_left">Copyright &copy; 2011 - All Rights Reserved - <a href="#">Domain Name</a></p>
    <p class="fl_right">Template by <a href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>
    <br class="clear" />
  </div>
</div>

<script type="text/javascript">
	function stopLong(){
		//shows stopLong strategy form if user selects it		
		if(document.getElementById("StopLong").value=="StopIndicator"){
			document.getElementById("StopIndicator").style.display="block";
		}else{
			document.getElementById("StopIndicator").style.display="none";
		}
		
	}
	
	function LongIndicator(){
			//shows LongIndicator strategy form if user selects it
			if(document.getElementById("LongTarget").value=="LongIndicator"){
			document.getElementById("LongIndicator").style.display="block";
		}else{
			document.getElementById("LongIndicator").style.display="none";
		}	
		
	}



        
function AutoInput(textbox, textboxinput){
//formating the backtesting form for the user
                if(document.getElementById(textbox).value=="SMA"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value=50;
                }
                if(document.getElementById(textbox).value=="EMA"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value=12;
                }
                if(document.getElementById(textbox).value=="ClosingPrice"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value ="none";
                }
                if(document.getElementById(textbox).value=="OpeningPrice"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value  = "none";
                }
                if(document.getElementById(textbox).value=="Highest"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Lowest"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Volume"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="RSI"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="Value"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 1;
                }
                if(document.getElementById(textbox).value=="SAR"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "0.02/0.2";
                }
                if(document.getElementById(textbox).value=="WMA"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 20;
                }
                if(document.getElementById(textbox).value=="BollingerUpper"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "20/2";
                }
                if(document.getElementById(textbox).value=="BollingerLower"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "20/2";
                }
                if(document.getElementById(textbox).value=="MacD"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "12/26/9";
                }
                if(document.getElementById(textbox).value=="MacDSignal"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "12/26/9";
                }
                if(document.getElementById(textbox).value=="ROC"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 12;
                }
                if(document.getElementById(textbox).value=="WilliamR"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="MTM"){
                         document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 9;
                }
                if(document.getElementById(textbox).value=="fastSTCk"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textbox).value = "20/5";
                }
                if(document.getElementById(textbox).value=="fastSTCd"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "20/5";
                }
                if(document.getElementById(textbox).value=="DMIplus"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 14;
                }
                if(document.getElementById(textbox).value=="DMIminus"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textbox).value = 14;
                }
				if(document.getElementById(textbox).value=="PVT"){
                        document.getElementById(textbox).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="OBV"){
                        document.getElementById(textbox).value="";
                document.getElementById(textboxinput).value = "none";
                }
				
				if(document.getElementById(textbox).value=="Above"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="Below"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = "none";
                }
                if(document.getElementById(textbox).value=="AtLeast%Above%"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 15;
                }
                if(document.getElementById(textbox).value=="AtLeast%Below%"){
                        document.getElementById(textboxinput).value="";
                document.getElementById(textboxinput).value = 15;
                }
                
                
    }
        
</script>

</body>
</html>
